<?php
/**
 * 公共模型
 * User: Traun
 * Date: 2021/8/21
 * Time: 13:59
 * @copyright Copyright (c) 湖南悦奥网络技术有限公司 .
 */

class Model
{
    protected $table;
    protected $where;
    protected $db = null;
    public function __construct()
    {
        $this->init();
    }
    private function init(){
        $dbConfig = [
            'host' => '127.0.0.1',
            'dbname'    =>  'mvc',
            'username'  =>  'mvc',
            'password'  =>  'Lf7hyCcykH4TdcjN',
        ];
        $this->db = Db::getInstance($dbConfig);
    }

    public function find($table,$where){
        $sql = "select * from {$table} where {$where}";
        return $this->db->fetch($sql);
    }

    public function findAll($table,$where){
        $sql = "select * from {$table} where {$where}";
        return $this->db->fetch($sql);
    }
}